package com.qf.util;

import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 2019/11/18
 * Administrator
 * springmvc1118
 * 面向对象面向君  不负代码不负卿
 */
public class MyFilterA implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("初始化AFilter");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request=(HttpServletRequest)servletRequest;
        System.out.println("uri="+request.getRequestURI());
        System.out.println("AFilter开始执行,uri="+servletRequest.getRemoteAddr());
        filterChain.doFilter(servletRequest,servletResponse);  //执行下一个过滤器或处理方法
        System.out.println("AFilter结束执行");
    }

    @Override
    public void destroy() {
        System.out.println("销毁AFilter");
    }
}
